

import 'dart:math';

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

main()=>runApp(MyApp());

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData.light(),
      home: _Home()
    );
  }
}

class _Home extends StatefulWidget {
  const _Home({Key? key}) : super(key: key);

  @override
  __HomeState createState() => __HomeState();
}

class __HomeState extends State<_Home> {

  List _list=List.generate(100, (index) => index+1 );

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(centerTitle: true,title: Text("Wrap"),),
      body: Wrap(
        alignment: WrapAlignment.center,
        runAlignment: WrapAlignment.spaceAround,
        children:_list.map((e){
         var size= Random.secure().nextDouble()*100;
          return Container(
            width: size+50,
            height: 80,
            margin: EdgeInsets.all(10),
            padding: EdgeInsets.all(10),
            color: Colors.primaries[Random().nextInt(Colors.primaries.length-1)],
            constraints: BoxConstraints(),
             child: Text("${e}" ,textAlign: TextAlign.center,),
          );
        }).toList(),
      ),
    );
  }
}

